package com.homework;

public class demo09{
    public static void main(String[] args) {
        //定义数组
        int[] arr = new int[]{1, 4, 3, 4, 5, 4, 7};
        //动态初始化一个数组用来接收排序后的arr
        int[] arr1 = new int[7];
        //计数器记录奇数的个数
        int count = 0;
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]);
        }
        //遍历
        for (int i = 0; i < arr.length; i++) {

            if (arr[i] % 2 == 0) {
                arr1[arr.length - i + count] = arr[i];
                count++;
            } else {
                arr1[count] = arr[i];
            }
        }
        for (int i = 0; i < arr1.length; i++) {
            System.out.print(arr1[i] + " ");
        }
    }
}

